package models

import "gorm.io/gorm"

type Article struct {
	gorm.Model

	Title    string `form:"title" gorm:"type:varchar(1024);not null;comment:文章标题" valid:"Required;MinSize(1)" json:"title"`
	Cid      int    `form:"cid" gorm:"type:int;not null;comment:类别ID" json:"cid"`
	Tids     string `form:"tids" gorm:"type:string;comment:标签ID，以(,)分隔" json:"tids"`
	Desc     string `form:"desc" gorm:"type:varchar(1024);not null;comment:文章简要描述" json:"desc"`
	Content  string `form:"content" gorm:"type:longtext;not null;comment:文章内容" valid:"Required;MinSize(1)" json:"content"`
	ViewNum  int    `form:"viewnum" gorm:"type:int;default 0;comment:浏览数" json:"viewnum"`
	LikeNum  int    `form:"likenum" gorm:"type:int;default 0;comment:点赞数" json:"likenum"`
	Top      int 	`form:"top" gorm:"type:tinyint(3);default 0;comment:是否顶置，0不顶置，1顶置" json:"top"`
	Reward	 int 	`form:"reward" gorm:"type:tinyint(3);default 0;comment:是否接受打赏，0不接受，1接受" json:"reward"`
	Status	 int 	`form:"status" gorm:"type:tinyint(3);default 0;comment:状态，0为已发布，1为草稿" json:"status"`

	Category Category `gorm:"-"`
	Tags []Tag `gorm:"-"`
}